import java.lang.module.FindException;

class Alg<T extends Comparable<T>> {
    public T FindMax(T[] array) {
        T max = array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i].compareTo(max) > 0) {
                max = array[i];
            }
        }
        return max;
    }

}
class Alg2{
    public <T extends Comparable<T>> T FindMax(T[] array){
        T max = array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i].compareTo(max) > 0){
                max = array[i];
            }
        }
        return max;
    }
}
class Alg3{
    public static  <T extends Comparable<T>> T FindMax(T[] array){
        T max = array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i].compareTo(max) > 0){
                max = array[i];
            }
        }
        return max;
    }
}

public class Test {
    public static void main(String[] args) {
        Integer[] array = {1,20,18,3,9,30};
        int ret = Alg3.FindMax(array);
        System.out.println(ret);

    }
    public static void main2(String[] args) {
        Alg2 alg2 = new Alg2();
        Integer[] array = {1,20,18,3,9,30};
        alg2.FindMax(array);
        alg2.<Integer>FindMax(array);
       // Integer integer = alg2.FindMax(array);
        //System.out.println(integer);


    }

    public static void main1(String[] args) {
       // MyArray<Integer> myArray = new MyArray<>();
        Alg<Integer> alg = new Alg<>();
        Integer[] array = {1,20,18,3,9,30};
        Integer integer = alg.FindMax(array);
        System.out.println(integer);


    }
}
